using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using net_work.Data.Entity.Cou;

namespace net_work.Config.DataBaseConfig.Cou;

/// <summary>
/// 教师授课实体配置类
/// </summary>
public class TeacherTeachingEntityTypeConfiguration : IEntityTypeConfiguration<TeacherTeaching>
{
    public void Configure(EntityTypeBuilder<TeacherTeaching> builder)
    {
        builder.ToTable("cou_teach_tcr");

        builder.HasKey(tt => tt.Id);

        // 配置字段名映射
        builder.Property(tt => tt.Id).HasColumnName("teach_tcr_id");
        builder.Property(tt => tt.TeachId).HasColumnName("teach_id").IsRequired();
        builder.Property(tt => tt.TeacherId).HasColumnName("tcr_id").IsRequired();

        builder.Property(tt => tt.CreatedBy).HasColumnName("create_by").IsRequired().HasMaxLength(64);
        builder.Property(tt => tt.CreatedTime).HasColumnName("create_time").IsRequired();
        builder.Property(tt => tt.UpdatedBy).HasColumnName("update_by").IsRequired().HasMaxLength(64);
        builder.Property(tt => tt.UpdatedTime).HasColumnName("update_time").IsRequired();
        builder.Property(tt => tt.Remark).HasColumnName("remark").HasMaxLength(256);
        builder.Property(tt => tt.DelFlag).HasColumnName("del_flag").HasDefaultValue('0');
    }
}